<template>
	<view class="wrap">
		<view class="form">
			<u--form labelPosition="top" :model="form" :rules="rules" labelWidth="120" ref="uForm">
			
				<u-form-item required label="清掏描述" prop="remark">
					<u--textarea
					  v-model="form.remark"
					  placeholder="标记油水分离器或隔油井及其数量信息。例：油水分离器 2个。"
					  border="none"
					></u--textarea>
				</u-form-item>
			</u--form>
		</view>
		
		<view class="btn-box">
			<view class="btn btn2" @click="submit()">确认提交</view>
		</view>

	</view>
</template>

<script>
	import LSelect from "@/components/LSelect";
	
	import { clearApplication,receiptShipmentRecordsDetails} from "@/api";
	export default {
		components: {
			LSelect
		},
		data() {
			return {
				form:{
					deptId:'',
					remark:'',
				},
				rules: {
					remark: {
						type: "string",
						required: true,
						message: "请输入清掏描述",
						trigger: ["blur"],
					},
				},
				params:{}
			};
		},
		watch: {

		},
		onLoad(params) {
			console.log(params);
			this.params = params;
			let deptId = uni.getStorageSync('deptId')
			this.form.deptId = deptId
		},
		onShow() { 
			this.getDetails()
		},
		onUnload() { },
		methods: {
			getDetails(){
				if(this.params.id){
					receiptShipmentRecordsDetails(this.params.id).then((res) => {
						this.form.remark = res.data.remark;
					});
				}
			},
			// 提交
			submit(){

				this.$refs.uForm.validate().then((res) => {
					clearApplication(this.form).then((res) => {
						this.$toast("提交成功");
						this.$route({
						  type: "back",
						  isDelay: true,
						});
					});
				}).catch(errors => {
					// uni.$u.toast('校验失败')
				})
			}
		},
	};
</script>

<style lang="less" scoped>
.wrap{
	padding: 30rpx;
	.item{
		margin-bottom: 30rpx;
		.title-box{
			margin-bottom: 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.title{
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 30rpx;
				color: #000000;
			}
			.del{
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				font-size: 30rpx;
				color: #138E57;
			}
		}
		
	}
	.form{
		background: #fff;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding: 0 30rpx 20rpx 40rpx;
	}

	.btn-box{
		margin-top: 60rpx;
		.btn{
			width: 610rpx;
			height: 80rpx;
			background: #F7F7F7;
			border-radius: 200rpx 200rpx 200rpx 200rpx;
			border: 2rpx solid #138E57;
			
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: #138E57;
			line-height: 80rpx;
			text-align: center;
			margin: 0 auto;
		}
		.btn2{
			background: linear-gradient( 83deg, #48B453 0%, #2C9F79 100%);
			color: #fff;
			margin-top: 30rpx;
		}
	}
}
</style>